{% extends "bootstrap/base.html" %}

{% block title %}Flasky{% endblock %}

{% block head %}
{{ super() }}
<link rel="shortcut icon" href="{{ url_for('static', filename = 'favicon.ico') }}"
      type="image/x-icon">

<link rel="icon" href="{{ url_for('static', filename = 'favicon.ico') }}"
      type="image/x-icon">
<link href="{{ url_for('static', filename='css/auth/login.css') }}" rel="stylesheet" type="text/css">
<link href="{{ url_for('static', filename='css/commom.css') }}" rel="stylesheet" type="text/css">
{% endblock %}

{% block navbar %}

<div class="navbar navbar-inverse" role="navigation">
    <div class="container">
        <div class="navbar-header">
            <button type="button" class="navbar-toggle"
            data-toggle="collapse" data-target=".navbar-collapse">
                <span class="sr-only">Toggle navigation</span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
            </button>
            <a class="navbar-brand" href="/">首页</a>
        </div>
        <div class="navbar-collapse collapse">
            <ul class="nav navbar-nav">
                <li><a href="/">话题</a></li>
                <!--{% if current_user.can(Permission.MODERATE_COMMENTS) %}-->
                <!--<li>-->
                    <!--<a href="{{ url_for('main.moderate') }}">评论查看</a>-->
                <!--</li>-->
                <!--{% endif %}-->
                {% if request.endpoint == 'main.index' %}
                    <li class="search-post">
                        <input size="15" class="form-control float-left" type="text" name="search_post" />
                    </li>
                    <li class="search-button">
                        <button class="btn btn-primary float-left">搜索</button>
                    </li>
                {% endif %}
            </ul>
            <ul class="nav navbar-nav navbar-right">
                {% if current_user.is_authenticated %}
                <li>
                    <a href="{{ url_for('main.user', username=current_user.username) }}">
                    {% if current_user.is_authenticated %}
                        {{ current_user.username }}
                    {% endif %}
                    </a>
                </li>
                <li><a href="{{ url_for('auth.logout') }}">登出</a></li>
                {% else %}
                <li><a href="{{ url_for('auth.login') }}">登陆</a></li>
                {% endif %}
            </ul>
        </div>
    </div>
</div>
{% endblock %}

{% block content %}
<div class="container">
    {% for message in get_flashed_messages() %}
    <div class="alert alert-warning">
        <button type="button" class="close" data-dismiss="alert">
            &times;
        </button>
        {{ message }}
    </div>
    {% endfor %}
    {% block page_content %}{% endblock %}
</div>
{% endblock %}

{% block scripts %}
{{ super() }}
{{ moment.include_moment() }}
{% endblock %}